﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions;
using CrystalDecisions.Enterprise;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.ReportSource;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace SecuritySystem.Reports
{
    public partial class CardReportForm : Form
    {
        public string photoImage = @"C:\TechxionDB\Photos\user.jpg";
        public string barCodeImage = @"C:\TechxionDB\Photos\BarCode.jpg";
        public string nameUser = "طاہر روف";
        public string fatherName = "عبدالروف بٹ";
        public string referenceUser = "چوکیدار";
        public string presentAddress = "مکان نمبر ۵، ٹیک سوسائٹی";
        public string startDate= "19-03-12";
        public string endDate= "19-03-13";
        public string dateOfBirth = "19-03-13";
        public string techNumber = "1234";

        public CardReportForm()
        {
            InitializeComponent();
        }

        private void CardReportForm_Load(object sender, EventArgs e)
        {
            Reports.BusinessCardReport reportobj = new BusinessCardReport();

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = barCodeImage;
            crParameterFieldDefinitions = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions[0];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            ParameterFieldDefinitions crParameterFieldDefinitions1;
            ParameterFieldDefinition crParameterFieldDefinition1;
            ParameterValues crParameterValues1 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();

            crParameterDiscreteValue1.Value = photoImage;
            crParameterFieldDefinitions1 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition1 = crParameterFieldDefinitions1[1];
            crParameterValues1 = crParameterFieldDefinition1.CurrentValues;

            crParameterValues1.Clear();
            crParameterValues1.Add(crParameterDiscreteValue1);
            crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);

            ParameterFieldDefinitions crParameterFieldDefinitions2;
            ParameterFieldDefinition crParameterFieldDefinition2;
            ParameterValues crParameterValues2 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue2 = new ParameterDiscreteValue();

            crParameterDiscreteValue2.Value = nameUser;
            crParameterFieldDefinitions2 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition2 = crParameterFieldDefinitions2[2];
            crParameterValues2 = crParameterFieldDefinition2.CurrentValues;

            crParameterValues2.Clear();
            crParameterValues2.Add(crParameterDiscreteValue2);
            crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2);

            ParameterFieldDefinitions crParameterFieldDefinitions3;
            ParameterFieldDefinition crParameterFieldDefinition3;
            ParameterValues crParameterValues3 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue3 = new ParameterDiscreteValue();

            crParameterDiscreteValue3.Value = fatherName;
            crParameterFieldDefinitions3 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition3 = crParameterFieldDefinitions3[3];
            crParameterValues3 = crParameterFieldDefinition3.CurrentValues;

            crParameterValues3.Clear();
            crParameterValues3.Add(crParameterDiscreteValue3);
            crParameterFieldDefinition3.ApplyCurrentValues(crParameterValues3);

            ParameterFieldDefinitions crParameterFieldDefinitions4;
            ParameterFieldDefinition crParameterFieldDefinition4;
            ParameterValues crParameterValues4 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue4 = new ParameterDiscreteValue();

            crParameterDiscreteValue4.Value = referenceUser;
            crParameterFieldDefinitions4 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition4 = crParameterFieldDefinitions4[4];
            crParameterValues4 = crParameterFieldDefinition4.CurrentValues;

            crParameterValues4.Clear();
            crParameterValues4.Add(crParameterDiscreteValue4);
            crParameterFieldDefinition4.ApplyCurrentValues(crParameterValues4);

            ParameterFieldDefinitions crParameterFieldDefinitions5;
            ParameterFieldDefinition crParameterFieldDefinition5;
            ParameterValues crParameterValues5 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue5 = new ParameterDiscreteValue();

            crParameterDiscreteValue5.Value = presentAddress;
            crParameterFieldDefinitions5 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition5 = crParameterFieldDefinitions5[5];
            crParameterValues5 = crParameterFieldDefinition5.CurrentValues;

            crParameterValues5.Clear();
            crParameterValues5.Add(crParameterDiscreteValue5);
            crParameterFieldDefinition5.ApplyCurrentValues(crParameterValues5);

            ParameterFieldDefinitions crParameterFieldDefinitions6;
            ParameterFieldDefinition crParameterFieldDefinition6;
            ParameterValues crParameterValues6 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue6 = new ParameterDiscreteValue();

            crParameterDiscreteValue6.Value = startDate;
            crParameterFieldDefinitions6 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition6 = crParameterFieldDefinitions6[6];
            crParameterValues6 = crParameterFieldDefinition6.CurrentValues;

            crParameterValues6.Clear();
            crParameterValues6.Add(crParameterDiscreteValue6);
            crParameterFieldDefinition6.ApplyCurrentValues(crParameterValues6);

            ParameterFieldDefinitions crParameterFieldDefinitions7;
            ParameterFieldDefinition crParameterFieldDefinition7;
            ParameterValues crParameterValues7 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue7 = new ParameterDiscreteValue();

            crParameterDiscreteValue7.Value = endDate;
            crParameterFieldDefinitions7 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition7 = crParameterFieldDefinitions7[7];
            crParameterValues7 = crParameterFieldDefinition7.CurrentValues;

            crParameterValues7.Clear();
            crParameterValues7.Add(crParameterDiscreteValue7);
            crParameterFieldDefinition7.ApplyCurrentValues(crParameterValues7);

            ParameterFieldDefinitions crParameterFieldDefinitions8;
            ParameterFieldDefinition crParameterFieldDefinition8;
            ParameterValues crParameterValues8 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue8 = new ParameterDiscreteValue();

            crParameterDiscreteValue8.Value = techNumber;
            crParameterFieldDefinitions8 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition8 = crParameterFieldDefinitions8[8];
            crParameterValues8 = crParameterFieldDefinition8.CurrentValues;

            crParameterValues8.Clear();
            crParameterValues8.Add(crParameterDiscreteValue8);
            crParameterFieldDefinition8.ApplyCurrentValues(crParameterValues8);

            ParameterFieldDefinitions crParameterFieldDefinitions9;
            ParameterFieldDefinition crParameterFieldDefinition9;
            ParameterValues crParameterValues9 = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue9 = new ParameterDiscreteValue();

            crParameterDiscreteValue9.Value = dateOfBirth;
            crParameterFieldDefinitions9 = reportobj.DataDefinition.ParameterFields;
            crParameterFieldDefinition9 = crParameterFieldDefinitions9[9];
            crParameterValues9 = crParameterFieldDefinition9.CurrentValues;

            crParameterValues9.Clear();
            crParameterValues9.Add(crParameterDiscreteValue9);
            crParameterFieldDefinition9.ApplyCurrentValues(crParameterValues9);
            

                     
            this.crystalReportViewer1.ReportSource = reportobj;
        }
    }
}
